package com.qf.limit.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.limit.entity.Friendrelation;
import com.qf.limit.entity.vo.FriendVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * (Friendrelation)表数据库访问层
 *
 * @author makejava
 * @since 2024-09-13 12:48:10
 */
public interface FriendrelationDao extends BaseMapper<Friendrelation> {
    /**
     * 批量新增数据(mybatis原生foreach方法)
     *
     *
     */
    int insertBatch(@Param("entities") List<Friendrelation> entities);

    int insertOrUpdateBatch(@Param("entities") List<Friendrelation> entities);
    @Select("SELECT u.id, u.header, IF(fr.beizhu=\"\",u.nickname, fr.beizhu)As" +
            "nickname FROM friendrelation fr JOIN user u ON fr.fid = u.id WHERE fr.uid=#{uid}")
    List<FriendVo> queryMyFriend(Integer uid);

}

